﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.ObjectMapping;

namespace Himp.Platform
{
    /// <summary>
    /// 菜单授权
    /// </summary>
    public class MenuGrantService : PlatformAppService
    {
        private IRepository<Menu, Guid> _menuRepository;
        private IMenuGrantRepository _menuGrantRepository;

        public MenuGrantService(IMenuGrantRepository menuGrantRepository, IRepository<Menu, Guid> menuRepository) 
        {
            _menuGrantRepository = menuGrantRepository;
            _menuRepository = menuRepository;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<List<MenuDto>> GetListAsync(MenuInput input)
        {
            var menus =await _menuGrantRepository.GetListAsync();
            var menuDto = ObjectMapper.Map<List<Menu>, List<MenuDto>>(menus);

            return menuDto;
        }
    }
}
